﻿// <copyright>
// Copyright (c) Microsoft Corporation.  All rights reserved.
// </copyright>

using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Runtime.Serialization;

namespace CloudMLDemo.Models
{
    public class ScoreData
    {
        [DataMember]
        public Dictionary<string, string> FeatureVector { get; set; }

        [DataMember(IsRequired = false)]
        public Dictionary<string, string> GlobalParameters { get; set; }

        public override string ToString()
        {
            return string.Format(
                CultureInfo.InvariantCulture,
                "[ScoreInstance: FeatureVector={0}, GlobalParameters={1}",
                string.Join(";", FeatureVector.Select(f => string.Format(CultureInfo.InvariantCulture, "{0},{1}", f.Key, f.Value))),
                (GlobalParameters == null) ? null : string.Join(";", GlobalParameters.Select(g => string.Format(CultureInfo.InvariantCulture, "{0},{1}", g.Key, g.Value))));
        }
    }
}